/*
 * Feature.cpp
 *
 *  Created on: 2018��9��13��
 *      Author: jia
 */

#include <Feature.h>

double Feature::value(double data){
	double result = -1.0;
	if(this->mode==0){
		for(int i=0;i<this->values.size();i++){
			if(data == this->values[i]){
				result = this->values[i];
			}
		}
	}
	else{
		for(int i=0;i<this->values.size();i++){
			if(data< this->values[0]){
				result = this->values[0];
				break;
			}
			else if(data>this->values[this->values.size()-1]){
				result = this->values[this->values.size()-1];
				break;
			}
			else if(data<this->values[i]&&data>this->values[i-1]){
				result = this->values[i];
			}
		}
	}
	return result;
}
